package org.thread.test05.syn.demo04;

/**
 * 第二个线程 - 有一把锁对象为：TWO_LOCK
 *
 * @author CSY
 * @date 2025 - 03 - 13
 */
public class TwoThread extends Thread {
    /**
     * 第二把锁
     */
    public static final Object TWO_LOCK = new Object();

    @Override
    public void run() {

        synchronized(TWO_LOCK) {
            System.out.printf("线程二获得第二把锁%s,执行相关的业务代码%n","TWO_LOCK");

            synchronized (OneThread.ONE_LOCK) {
                System.out.printf("线程二获得第一把锁%s,执行相关的业务代码%n","ONE_LOCK");
            }
        }
    }
}
